import 'package:flutter/material.dart';
import 'package:flutter_application_1/config/app_colors.dart';

class UserType {
  static Map enType = {
    "NORMAL_USER": "NORMAL_USER",
    "DQ_SINGER": "DQ_SINGER",
    "DQ_OFFICIAL_ACCOUNT": "DQ_OFFICIAL_ACCOUNT",
    "ADMIN": "ADMIN"
  };
  static Map cnType = {
    "NORMAL_USER": "普通用户",
    "DQ_SINGER": "读琴歌手",
    "DQ_OFFICIAL_ACCOUNT": "读琴号",
    "ADMIN": "管理员"
  };
  static Map colorType = {
    "NORMAL_USER": AppColors.unactive,
    "DQ_SINGER": AppColors.info,
    "DQ_OFFICIAL_ACCOUNT": AppColors.success,
    "Admin": AppColors.danger
  };

  static String fromCn(String type) {
    return cnType[type] ?? '游客用户';
  }

  static String fromEn(String type) {
    return enType[type];
  }

  static Color fromColor(String type) {
    return colorType[type] ?? AppColors.unactive;
  }

  static bool isNormal(String type) => type == 'NORMAL_USER';
  static bool isSinger(String type) => type == 'DQ_SINGER';
  static bool isOfficial(String type) => type == 'DQ_OFFICIAL_ACCOUNT';
  static bool isAdmin(String type) => type == 'ADMIN';
}
